<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/23
 * Time: 15:43
 */

namespace app\api\model;


class Banner extends BaseModel
{

    //protected $table = 'banner_item'; 表名
    protected $hidden = ['update_time','delete_time']; //隐藏字段

    public function items(){
        return $this->hasMany('BannerItem','banner_id','id');
    }

    public function getBannerById($id){

        return $this->with(['items','items.img'])->find($id);

    }

}